#!/usr/bin/python3
import sys

list = [1, 2, 3, 4, 5]
# 创建迭代器
it = iter(list)

while True:
    try:
        print(next(it))
    except StopIteration:
        # 迭代无下一个，终止
        sys.exit()
